<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>资源请求</title>
    <link rel="stylesheet" href="./style.css">
</head>

<body>
    <section>
        <div class="resource"></div>
        <div class="btn">
            <p>资源请求</p>
        </div>
    </section>

    <script>
        const btn = document.querySelector('.btn');
        const resource = document.querySelector('.resource');
        let pic = document.createElement("img");//创建图片
        pic.src = "../public/ellie.png";

        btn.addEventListener("click", function () {
            // // ajax请求
            // const xhr = new XMLHttpRequest();
            // //设置请求的方法和url
            // // xhr.open('GET','');
            // xhr.onreadystatechange = function(){
            //     if(xhr.readyState === 4){
            //         if(xhr.status >=200 && xhr.status <300){
            //         }
            //     }
            // }
            resource.appendChild(pic);

        });
    </script>
</body>

</html>